package com.jni.jni_demo.controller;

import com.jni.jni_demo.service.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class Hello {

    @RequestMapping("/say")
    public void say(){
        System.out.println( System.getProperty("java.library.path"));
        // ###（mac 下生成libHello.jnilib）
        // g++ -dynamiclib -I /System/Library/Frameworks/JavaVM.framework/Headers com_jni_jni_demo_service_Test.cpp -o libHello.jnilib
        // 需要将 libHello.jnilib cp 到 java.library.path 对应的目录中去，否则找不到 Hello 这个库文件
        System.loadLibrary("Hello");
        Test test = new Test();
        test.sayHello();
    }
}
